<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app"></div>
    
    <script src="./render.js"></script>
    <script>
        //1.通过h函数来创建一个  vNode
        const vnode = h("div", {class: "yzh", id:"aaa", onClick: () => {console.log('111')}}, [
            h("h2", null, "当前计数：99"),
            h("button", null, "+1")
        ]);  //这里就已经是 虚拟dom了 vdom
        
        //2.mount的实现 把虚拟vnode挂载到div#app
        mount(vnode, document.querySelector("#app"));

        //3.创建新的vnode
        // setTimeout(() => {   //标签不同
        //     const vnode2 = h("h2", {class: "sabo"}, "哈哈哈哈");
        //     patch(vnode, vnode2);
        // },2000)

        setTimeout(() => {
            const vnode2 = h("div", {class: "yzhyzh", id: "aaa"}, "哈哈哈哈");
            patch(vnode, vnode2)
        }, 2000);
        
    </script>
</body>
</html>